package com.wk.springcloud.faces.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.wk.springcloud.user.feign.interfaces.IFeignUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    IFeignUser feignUser;

    @GetMapping("/faces/hello")
    @HystrixCommand(fallbackMethod="hystrixHandler")
    public String hello(){
        String hello = feignUser.hello();
        return hello;
    }

    public String hystrixHandler(){
        return "出错了！！！o(╥﹏╥)o";
    }

}
